package com.ian.cloud;

import com.ian.client.OrderServiceClient;
import com.ian.dto.OrderDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.Map;
import java.util.UUID;

/**
 * 调用订单微服务
 */
@RestController
public class OrderController {
    @Autowired
    OrderServiceClient orderServiceClient;

    @PostMapping("/createorder")
    public Map order(@RequestBody OrderDTO orderDTO) {
        orderDTO.setNum(UUID.randomUUID().toString());
        orderDTO.setCreatetime(new Date());
        System.out.println("---------" + orderDTO.getEndtime());
        return orderServiceClient.order(orderDTO);
    }
}
